
function Run-UpdateDBScripts {
    param (
        [Parameter(Mandatory = $true)][LSInsightParameters]$LSInsight
    )

    # Locate the sql files.
    $updatefolder = (Get-Item $PSScriptRoot ).parent.parent.Parent
    $folder = Join-Path -Path $updatefolder.FullName -ChildPath "LSInsightDB_updatescripts\"
    $files = (Get-ChildItem -Path $folder -Filter "*.sql").FullName

    # Create tables.
    Write-Host # Newline.
    Write-Host "Executing update scripts in the LS Insight database..."
    $lsinsightlogin = @{
        ServerName = $LSInsight.Server.FullyQualifiedDomainName
        DatabaseName = $LSInsight.Database.Name
        Credential = $LSInsight.Server.Credential
    }
    Invoke-MultipleSQLScripts @lsinsightlogin -Files $files | Out-Null
}